<script type="text/javascript" src="js/pizza-builder.js"></script>

<form id="pizzaform" method="post">
  <div id="pizza-builder">
    <h1>Pizza Builder</h1>
    <div class="pizza-sizes">
      <p><strong>{$lang.pizzabuilder_choose}</strong></p>
      {foreach from=$allpizzas item=pizzalist key=k}
        <div>
          <label>{$pizzalist.name|stripslashes}</label>
          <input class="calc"
            type="radio"
            onclick="reDirPizzaSize({$pizzalist.id})"
            name="size"
            value="{$pizzalist.id}"
            {if $k eq 0 or $smarty.get.id eq $pizzalist.id}
              checked="checked"
            {/if}
          >
          {$pizzalist.price|price_format} 
          {if $pizzalist.topping_price > 0 }
            <em>(+ {$pizzalist.topping_price|price_format} {$lang.pizzabuilder_per_topping})</em> 
          {/if}
          {if $pizzalist.free_topping eq 1}
            <span style="color:green">{$lang.first_topping_free}</span>
          {/if}
        </div>
      {/foreach}
      <div>
        <label>{$lang.pizzabuilder_quantity_label}</label>
        <input type="text" name="quantity" value="1" size="5">
      </div>
      {if $who_for eq 1}
        <div>
          <label>{$lang.pizzabuilder_who_question}</label>
          <input type="text" name="forwho" >
        </div>
      {/if}
    </div>
  </div>
  <div id="pizza-container">
    <div id="pizza-tabs">
      <ul>
        <li><a href="#tabs-1">{$lang.pizzabuilder_vegetable_label}</a></li>
        <li><a href="#tabs-2">{$lang.pizzabuilder_meat_label}</a></li>
        <li><a href="#tabs-3">{$lang.pizzabuilder_bread_label}</a></li>
      </ul>
      <div id="tabs-1">
        <div style="min-height:350px"> <a name="tabs-1"></a>
          <p><strong>{$lang.pizzabuilder_additional_veg_toppings}</strong></p>
          {include file="modules/pbToppings.tpl" toppings = $pizza.toppings}
          {if $pizza.topoff.0 ne ""}
            <p><strong>{$lang.pizzabuilder_top_it_off_label}</strong></p>
            {include file='modules/pbToppings.tpl' toppings = $pizza.topoff}
          {/if} 
        </div>
      </div>
      <div id="tabs-2">
        <div style="min-height:350px"> <a name="tabs-2"></a>
          <p><strong>{$lang.pizzabuilder_additional_meat_toppings}</strong></p>
          {include file='modules/pbToppings.tpl' toppings = $pizza.meat_toppings}
        </div>
      </div>
      <div id="tabs-3">
        <div style="min-height:350px"> <a name="tabs-3"></a>
          <p><strong>{$lang.pizzabuilder_choose_bread}</strong></p>
          <table width="100%" border="0" cellspacing="5" cellpadding="5">
            {foreach from=$pizza.base item=base key=k}
              {assign var=baseArray value=":"|explode:$base} 
              {assign var=baseName value=$baseArray.0}
              {assign var=basePrice value=$baseArray.1}
              {assign var=baseDefault value=$baseArray.2}
              <tr>
                <td width="200">            
                  {$baseName}{if $basePrice.1 ne ""}<span style="color:green"> <em>(+{$basePrice.1|price_format})</em></span>{/if} 
                </td>
                <td style="text-align:center"><input class="calc" type="radio" name="base" value="{$base}"  {$baseDefault} ></td>
              </tr>
            {/foreach} 
          </table>

          <p><strong>{$lang.pizzabuilder_choose_sauce}</strong></p>
          <table width="100%" border="0" cellspacing="5" cellpadding="5">
            {foreach from=$pizza.sauce item=sauce key=k}
              {assign var=sauceArray value=":"|explode:$sauce} 
              {assign var=sauceName value=$sauceArray.0}
              {assign var=saucePrice value=$sauceArray.1}
              {assign var=sauceDefault value=$sauceArray.2}
              <tr>
                <td width="200">            
                  {$sauceName}{if $saucePrice.1 ne ""}<span style="color:green"> <em>(+{$saucePrice.1|price_format})</em></span>{/if} 
                </td>
                <td style="text-align:center"><input class="calc" type="radio" name="sauce" value="{$sauce}"  {$sauceDefault} ></td>
              </tr>
            {/foreach} 
          </table>
        </div>
      </div>
    </div>
  </div>
  <div class="pizza-sizes">
    <div>
      <label>{$lang.pizzabuilder_additional_instructions_message}</label>
      <textarea name="instructions" style="width:340px;height:60px"></textarea>
    </div>
    <div style="text-align:right;font-size:1.2em;margin-top:25px;">
      <label>{$lang.pizzabuilder_total_per_pizza}</label>
      <span id="pizza_price">{$pizzas.0.price|price_format}</span>
      <span class="button">
        <a href="" class="add-pizza">{$lang.pizzabuilder_add_button}</a>
      </span>
    </div>
  </div>
</form>
